import { ApiProperty } from '@nestjs/swagger';
import { IsEnum } from 'class-validator';

enum FileType {
  doc = 'doc',
  xls = 'xls',
  md = 'md',
  pdf = 'pdf',
  folder = 'folder',
}

export class preUploadDto {
  @ApiProperty({
    example: '123.doc',
  })
  filename: string;

  @ApiProperty({
    example: FileType.doc,
    enum: FileType,
  })
  @IsEnum(FileType)
  filetype: FileType;
}

export class completeUploadDto {
  @ApiProperty({
    example: '6662d622-b4c8-4425-8c20-47354063e412',
  })
  id: string;

  @ApiProperty({
    example: '123.doc',
  })
  name: string;

  @ApiProperty({
    example: '65e5edad-6c99-484e-b48c-7405de7343a3',
  })
  folderId: string;

  @ApiProperty({
    example: FileType.doc,
    enum: FileType,
  })
  @IsEnum(FileType)
  filetype: FileType;

  @ApiProperty({
    example: 'doc/1/6662d622-b4c8-4425-8c20-47354063e412_123.doc',
  })
  ossPath: string;

  @ApiProperty({
    example: 4,
  })
  groupId?: number;
}
